package com.me.screen;

import com.badlogic.gdx.Screen;
import com.me.enums.ScreenEnum;

public class ScreenManager {
	private Screen screen;

	public ScreenManager() {
		
	}

	public Screen getScreen() {
		if (screen == null) {
			screen = new MainMenuScreen();
		}
		return screen;
	}

	public Screen createScreen(ScreenEnum scr) {
		switch (scr) {
			case LOADING_SCREEN:
				clearScreen();
				screen = new LoadingScreen();
				return screen;
			case MENU_SCREEN:
				clearScreen();
				screen = new MainMenuScreen();
				return screen;
			case PLAY_SCREEN:
				clearScreen();
				screen = new PlayScreen();
				return screen;
			case HIGH_SCORE_SCREEN:
				clearScreen();
				screen = new BestScoreScreen();
				return screen;
			case END_GAME:
				clearScreen();
				screen = new EndGame();
				return screen;
			default:
				return new MainMenuScreen();
			}
	}

	private void clearScreen() {
		if (screen != null)
			screen.dispose();
	}
}
